package com.kebabeaters.nakebab.client.ui.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.kebabeaters.nakebab.client.resources.ResourcesFactory;
import com.kebabeaters.nakebab.client.resources.client.KebabResources;

public class TasterReview extends Composite {
	
	private final Widget widget;
	KebabResources resources = ResourcesFactory.getKebabResources();
	
	@UiField(provided = true)
	protected Image image;
	@UiField
	protected Label nick;
	@UiField
	protected Label rec;
	@UiField
	protected Label meat;
	@UiField
	protected Label vegetables;
	@UiField
	protected Label sauce;
	@UiField
	protected Label bread;
	@UiField
	protected Label price;
	@UiField
	protected Label plus;
	@UiField
	protected Label minus;

	public interface Binder extends UiBinder<Widget, TasterReview> {
	}

	public TasterReview() {
		Binder binder = GWT.create(Binder.class);
		
		image = new Image(resources.defaultAvatar().getSafeUri());
		image.setHeight("120px");
		image.setWidth("120px");
		
		widget = binder.createAndBindUi(this);
		
		initWidget(widget);
	}
	
	@Override
	public Widget asWidget() {
		return widget;
	}

	public void setNick(String nick) {
		this.nick.setText(nick);
	}

	public void setRec(String rec) {
		this.rec.setText(rec);
	}

	public void setMeat(String meat) {
		this.meat.setText(meat);
	}

	public void setVegetables(String vegetables) {
		this.vegetables.setText(vegetables);
	}

	public void setSauce(String sauce) {
		this.sauce.setText(sauce);
	}

	public void setBread(String bread) {
		this.bread.setText(bread);
	}

	public void setPrice(String price) {
		this.price.setText(price);
	}
	
	public void setPlus(Integer plus) {
		this.plus.setText(Integer.toString(plus) + "+");
	}
	
	public void setMinus(Integer minus) {
		this.minus.setText("-" + Integer.toString(minus));
	}
}
